package artid.com.arttogo.bean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;

public class PeopleList extends AppItem implements Serializable {
	ArrayList<item> listIncome  = new ArrayList<item>();
	ArrayList<item> listLike  = new ArrayList<item>();
	ArrayList<item> listIndustry  = new ArrayList<item>();
	
	public class item{
		String name,id;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}
		
	}

	@Override
	public void parse(JSONObject obj) {
		if (null == obj) {
			return;
		}
		initData(obj,"income",listIncome);
		initData(obj, "like", listLike);
		initData(obj, "industry", listIndustry);
	}
	
	void initData(JSONObject obj, String tag, ArrayList<item> list){
		JSONArray arrIncome = obj.optJSONArray(tag);
		for (int i = 0; i < arrIncome.length(); i++) {
			try {
				JSONObject object = arrIncome.getJSONObject(i);
				item t1 = new item();
				t1.setId(object.optString("id"));
				t1.setName(object.optString("name"));
				list.add(t1);
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	public ArrayList<item> getListIncome() {
		return listIncome;
	}

	public void setListIncome(ArrayList<item> listIncome) {
		this.listIncome = listIncome;
	}

	public ArrayList<item> getListLike() {
		return listLike;
	}

	public void setListLike(ArrayList<item> listLike) {
		this.listLike = listLike;
	}

	public ArrayList<item> getListIndustry() {
		return listIndustry;
	}

	public void setListIndustry(ArrayList<item> listIndustry) {
		this.listIndustry = listIndustry;
	}

	

	

}
